package history.study.array;

// 27. 移除元素:https://leetcode-cn.com/problems/remove-element/
public class LeetCode_27 {
    public int removeElement(int[] nums, int val) {
        if (nums == null || nums.length <= 0) return 0;
        int slow = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != val) {
                nums[slow] = nums[i];
                slow++;
            }
        }
        return slow;
    }
}
